package com.serviceImpl;

import com.dao.MemberDao;
import com.domain.Member;
import com.server.MemberService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("memberService")
public class MemberServiceImpl implements MemberService {

    @Resource(name="memberDao")
    private MemberDao memberDao;

    @Override
    public Member selectMemberById(Integer id) { return memberDao.selectMemberById(id); }

    @Override
    public String selectMemberByuser_idAndspace_id(@Param("user_id")Integer user_id, @Param("space_id")Integer space_id) {
        return memberDao.selectMemberByuser_idAndspace_id(user_id,space_id);
    }

    @Override
    public Member selectMemberByspace_id(Integer space_id) { return memberDao.selectMemberByspace_id(space_id); }

    @Override
    public int insertMember(Member member) { return memberDao.insertMember(member); }

    @Override
    public List<Member> findAllMember(int page, int pageSize,int space_id) {
        int from=(page-1)*pageSize;
        return memberDao.findAllMember(from,pageSize, space_id);
    }

    @Override
    public int findMemberTotal(int space_id) {
        return memberDao.findMemberTotal(space_id);
    }

    @Override
    public List<Member> selectAllMember(int space_id) {
        return memberDao.selectAllMember(space_id);
    }

    @Override
    public List<Member> selectMemberByName(String username,int space_id) {
        return memberDao.selectMemberByName(username,space_id);
    }

    @Override
    public int updateMember(Member member) {
        return memberDao.updateMember(member);
    }

    @Override
    public Member selectMemberById(int id) {
        return memberDao.selectMemberById(id);
    }

    @Override
    public int deleteById(@Param("space_id") Integer space_id, @Param("user_id") Integer user_id) {
        return memberDao.deleteById(space_id, user_id); }

    @Override
    public int deleteAllMemberBySpaceId(int space_id) {
        return memberDao.deleteAllMemberBySpaceId(space_id);
    }

    @Override
    public List<Member> selectMemberByUserId(int user_id) { return memberDao.selectMemberByUserId(user_id); }

    @Override
    public List<Member> descCreateDateByUserId(Integer user_id) { return memberDao.descCreateDateByUserId(user_id); }

}
